1. Field of the Invention
The present invention relates in general to the field of compiling applications to run on a computer platform, and more particularly to a system and method for binary translation to improve parameter passing between compiled functions.
2. Description of the Related Art
Software applications that run on computers are generally written in a development language, such as C++, and then compiled to a binary format adapted to the processor and operating system of the computer platform. Application code compiled to a binary format generally runs more efficiently since the processor and operating system platform faces fewer operations to perform functions defined by the code. Compiler languages typically use a modular design of discrete functions so that, for instance, an application is more easily developed by diverse teams of developers working on discrete modules. Often, a software application consists of several software utilities, known as libraries, which were developed by different software vendors and compiled by different compilers. Indeed, application developers often rely upon development toolkits to provide desired functions so that the developers do not have to “re-invent the wheel” each time a commonly-used function is desired. Development toolkits that are commercially available or that result from a development team's previous work may be used in development of a new application as long as the selected toolkit functions remain compatible with newly-developed functions. Maintaining compatibility between functional application modules saves considerable application development work by allowing developers to rely on existing modules, however, maintaining compatibility over time tends to introduce inefficiencies in the compilation of the application. For instance, a certain amount of “overhead” operations are typically performed to ensure compatibility of modules that may not take advantage of platform hardware and operating system improvements that have occurred in the time since the toolkit modules were developed.
One technique used to ensure compatibility between functional application modules is to define parameters that are used to pass information between functions. Typically, a caller function requests information with a defined parameter from a callee function and the callee function responds with defined parameters that are sent to the caller function. In order to ensure that information is passed correctly between utilities developed by different software vendors, computer platforms on which software applications are deployed typically define an Application Binary Interface (“ABI”). The ABI defines the manner in which parameters are passed between functions, such as through the stack frame or in registers, however, the ABI does not necessarily use the most efficient way to pass parameters for an overall application. Rather, compilers tend to work on individual modules without a whole-program view that sometimes exposes more optimal parameter passing possibilities. Generally, in order to determine the most efficient parameter passing possibilities, a compiler has to review an application as a whole instead of as separate and individual modules, otherwise all caller and callee functions are not visible to the compiler. Frequently, however, toolkit modules are compiled to binary format before combination into an application so that the application uses ABI defined parameter passing for the platform to ensure compatibility of all modules. If an application programmer elects to generate code with calling conventions for passing parameters that are different from those defined by the ABI, the programmer typically must manually review all caller and callee function pairs to ensure that consistent parameter passing assumptions are used or the compiled application will fail.